{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from bokeh.plotting import figure, show, output_notebook\n",
    "# %matplotlib inline 是一个 Jupyter Notebook 的魔法命令\n",
    "# 使得 matplotlib 绘制的图形可以直接在 Notebook 的输出单元格中显示。这个命令特别适合于数据分析和可视化的交互式环境。\n",
    "%matplotlib inline\n",
    "\n",
    "df=pd.read_csv(\"csv\\\\vbar_line_ circle.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['x', 'y', 'y1', 'y2'], dtype='object')\n"
     ]
    }
   ],
   "source": [
    "# 显示所有列名  \n",
    "print(df.columns)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Combining mutliple plots with different renders\n",
    "\n",
    "x = df[\"x\"].values[:10] #从 pandas DataFrame df 中提取 \"x\" 列的前10个值，并将这些值存储在变量 x 中。\n",
    "y1 = df[\"y\"].values[:10]\n",
    "y2 = df[\"y1\"].values[:10]\n",
    "y3 = df[\"y2\"].values[:10]\n",
    "p = figure(title=\"Multiple Plots\", \n",
    "           x_axis_label=\"X Values\",\n",
    "           y_axis_label=\"Y Values\",\n",
    "           width=800,height=400)\n",
    "p.vbar(x=x, top=y1, legend_label=\"y1\", color=\"skyblue\", width=0.5, bottom=0)\n",
    "p.line(x, y2, legend_label=\"y2\", color=\"black\", line_width=2)\n",
    "p.circle(x,y3,legend_label=\"y3\",fill_color=\"red\",fill_alpha=0.5,line_color=\"yellow\",size=10)\n",
    "# show the results\n",
    "show(p)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
